import axios from './axios'
// import qs from 'qs'

const sight = '/sight'

// 获取所有
const getSights = async (data) => {
  const rst = await axios.get(sight + '/getSights')
  return rst.data
}

// 添加
const insertSight = async (data) => {
  const rst = await axios.post(sight + '/insert', data)
  return rst.data
}

// 更新
const update = async (data) => {
  const rst = await axios.post(sight + '/update', data)
  return rst.data
}

// 删除
const deleteById = async (data) => {
  const rst = await axios.get(sight + '/delete?id=' + data)
  return rst.data.data
}

// 查找一个
const selectOne = async (data) => {
  const rst = await axios.get(sight + '/selectOne?id=' + data)
  return (rst.data.data)[0]
}

export {
  getSights,
  insertSight,
  selectOne,
  update,
  deleteById
}
